package com.tensquare.friend.dao;

import com.tensquare.friend.pojo.Friend;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * Friend Jpa Interface.
 *
 * @author 宫新程
 * @since 2019/3/18 18:53
 */
public interface FriendDao extends JpaRepository<Friend, String> {

  Friend findByUseridAndFriendid(String userid, String friendid);

  @Modifying
  @Query(
      value = "update tb_friend set islike = ? where userid = ? and friendid = ?",
      nativeQuery = true)
  void updateIsLike(String isLike, String userid, String friendid);
}
